package com.briup.hdfs;



import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.junit.Test;

import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;

public class HdfsClient {

    public void testMkdirs() throws IOException, URISyntaxException,InterruptedException{
        //1.获取文件系统
        Configuration configuration = new Configuration();
        FileSystem fs = FileSystem.get(new URI("hdfs://hadoop102:8020"), configuration,"zhang");


        //2.创建目录
        fs.mkdirs(new Path("/xiyou/husguoshan/"));

        //3.关闭资源
        fs.close();
    }

    public static void main(String[] args) throws InterruptedException, IOException, URISyntaxException {
        new HdfsClient().testMkdirs();
    }
}
